package com.example.italkapp2.utils.glide;

import com.bumptech.glide.annotation.GlideExtension;
import com.bumptech.glide.annotation.GlideOption;
import com.bumptech.glide.load.resource.bitmap.CircleCrop;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.bumptech.glide.request.BaseRequestOptions;
import com.example.italkapp2.R;

/**
 * @author MiloYe
 * @version 1.0
 * @description
 * @date 2021/5/29 17:12
 */
@GlideExtension
public class AppExtension {
    private AppExtension() {
    }

    @GlideOption
    public static BaseRequestOptions<?> defaultImg(BaseRequestOptions<?> options) {
        return options.placeholder(R.mipmap.ic_launcher)
                .error(R.mipmap.ic_launcher)
                .fallback(R.mipmap.ic_launcher)
                .override(500, 500)
                .transform(new CircleCrop());
    }

    @GlideOption
    public static BaseRequestOptions<?> defaultContact(BaseRequestOptions<?> options) {
        return options.placeholder(R.drawable.em_default_avatar)
                .error(R.mipmap.ic_launcher)
                .fallback(R.drawable.em_default_avatar)
                .override(500, 500)
                .transform(new CircleCrop());
    }
}
